import Router from '@koa/router'
import { UserController } from '../controllers/user'
import { DemoController } from '../controllers/demo'
import { TableConfigController } from '../controllers/table-config'
import { LoginController } from '../controllers/login'
import { OptionController } from '../controllers/options'
import { CodeController } from '../controllers/code'
import { branchController } from '../controllers/branch'
import { commitController } from '../controllers/commit'
import { developController } from '../controllers/develop'
import { gitLogController } from '../controllers/git-log'

const router = new Router({ prefix: '/admin' })

router.get('/users', UserController.getUsers)
router.post('/user/getUserInfo', UserController.getUserInfo)
router.post('/user/createUserBranch', UserController.createUserBranch)
router.post('/user/switchUserBranch', UserController.switchUserBranch)
router.post('/getOptions', OptionController.getOptions)
router.post('/systemOption/updateToken', OptionController.updateSystemOptionToken)
router.post('/demopost', DemoController.postData)
router.post('/tableConfig/getList', TableConfigController.getList)
router.post('/tableConfig/create', TableConfigController.create)
router.post('/tableConfig/updateDialogConfig', TableConfigController.updateDialogConfig)
router.post('/tableConfig/updateConfig', TableConfigController.updateConfig)
// router.post('/tableConfig/createCode', TableConfigController.createCode)
router.post('/tableConfig/getCode', CodeController.getCode)
// router.post('/tableConfig/updateCode', CodeController.updateCode)
router.post('/tableConfig/delete', TableConfigController.delete)
router.post('/demoApi/post', TableConfigController.emptyApi)
router.post('/login', LoginController.login)
router.post('/loginOut', LoginController.loginOut)
router.post('/options/branch', branchController.getBranchList)
router.post('/getCommitLogs', commitController.getCommitLogs)
router.post('/getRemoteCommitLogs', commitController.getRemoteCommitLogs)
router.post('/develop/pull', developController.pull)
router.post('/develop/push', developController.push)
router.post('/develop/copyLocalFileToDatabase', developController.copyLocalFileToDatabase)
router.post('/develop/getFileList', developController.getFileList)
router.post('/develop/setFileSign', developController.setFileSign)
router.post('/develop/batchSetFileSign', developController.batchSetFileSign)
router.post('/develop/delFileSign', developController.delFileSign)
router.post('/develop/batchDelFileSign', developController.batchDelFileSign)
router.post('/develop/getFileCode', developController.getFileCode)
router.post('/develop/getCommitMsg', developController.getCommitMsg)
router.post('/develop/updateCommitMsg', developController.updateCommitMsg)
router.post('/develop/updateCode', TableConfigController.updateCode)
router.post('/develop/saveDeveloper', developController.saveDeveloper)
router.post('/develop/endDevelop', developController.endDevelop)
router.post('/gitLog/publishEnvironment', gitLogController.publishEnvironment)
router.post('/gitLog/localRemoteLogList', gitLogController.gitLogList)
router.post('/gitLog/resetHard', gitLogController.gitResetHard)
router.post('/gitLog/mergeSameCommits', gitLogController.mergeSameCommits)
router.post('/gitLog/mergeOneCode', gitLogController.mergeOneCode)
router.post('/gitLog/mergeCode', gitLogController.mergeCode)

export default router
